<template>
  <div class="main">
    <el-container class="=main-content">
      <el-aside :width="isCollapse ? '60px' : '210px'"
        ><NavMenu :collapse="isCollapse"
      /></el-aside>
      <el-container class="page">
        <el-header class="page-header"
          ><NavHeader @foldChange="handleFoldChange"
        /></el-header>
        <el-main class="page-content"
          ><div class="page-info"><router-view></router-view></div
        ></el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
import NavMenu from '@/components/nav-menu'
import NavHeader from '@/components/nav-header'
export default defineComponent({
  components: {
    NavMenu,
    NavHeader
  },
  setup() {
    const isCollapse = ref(false)
    const handleFoldChange = (isFold: boolean) => {
      isCollapse.value = isFold
    }
    return {
      isCollapse,
      handleFoldChange
    }
  }
})
</script>
<style scoped lang="less">
.main {
  position: flexd;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.mian-content,
.page {
  position: flexd;
  height: 100vh;
}
.page-content {
  height: calc(100%-48px);
}
.page-info {
  background-color: #fff;
  border-radius: 5px;
}
.el-header,
.el-footer {
  display: flex;
  color: #333;
  text-align: center;
  align-items: center;
}
.el-header {
  height: 48px;
}
.el-aside {
  overflow-x: hidden;
  overflow-y: auto;
  line-height: 200px;
  text-align: left;
  cursor: pointer;
  background-color: #001529;
  transition: width 0.3s liner;
  scrollbar-width: none;
  -ms-overflow-style: none;
  &::-webkit-scrollbar {
    display: none;
  }
}
.el-main {
  color: #333;
  text-align: center;
  background-color: #f0f2f5;
}
</style>
